import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
export default defineConfig({
  plugins: [vue()],
  resolve:{
    alias:{
      "@":path.resolve("./src")//相对路径别名配置，用@代替src
    }
  }, 
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: '@use "@/styles/variable.scss" as *;',
      },
    },
  },
  server: {
    proxy: {
      ['/api']: {
        target: 'http://localhost:8080',  // 后端API地址
        changeOrigin: true,  // 是否允许跨域
        rewrite: (path) => path.replace(/^\/api/, ''),  // 重写路径
      }
    }
  }
})
